﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace GameOfLife.Drawing
{
    class Drawing
    {
        public static void DrawGrid(Canvas canvas, int size)
        {
            Line line;

            int counterHorizontal = (int)(canvas.Height / size);
            int counterVertical = (int)(canvas.Width / size);
            SolidColorBrush lineColor = new SolidColorBrush(Colors.Black);

            for (int i = 0; i <= counterHorizontal; i++)
            {
                line = new Line
                {
                    Stroke = lineColor,
                    X1 = 0,
                    X2 = (int)canvas.Width,
                    Y1 = 0,
                    Y2 = 0
                };

                //line.StrokeThickness = 4;
                canvas.Children.Add(line);
                Canvas.SetLeft(line, 0);
                Canvas.SetTop(line, size * i);
            }


            for (int i = 0; i <= counterVertical; i++)
            {
                line = new Line
                {
                    Stroke = lineColor,
                    X1 = 0,
                    X2 = 0,
                    Y1 = 0,
                    Y2 = (int)canvas.Height,
                };

                canvas.Children.Add(line);
                Canvas.SetLeft(line, size * i);
                Canvas.SetTop(line, 0);
            }
        }
    }
}
